ALTER   PROC sp_insert_ct_gp_vendor_mappings( @ctVendorId INT, @gpVendorId INT ) 
AS
BEGIN
DECLARE @tempVendorId INT

	IF @ctVendorId <> -1
	BEGIN
		SELECT @tempVendorId = CT_Vendor_Id FROM CT_GP_Vendor_Mapping WHERE CT_Vendor_Id = @ctVendorId
		
		IF @tempVendorId IS NULL
		BEGIN
			INSERT INTO CT_GP_Vendor_Mapping ( CT_Vendor_Id, GP_Vendor_Id ) VALUES ( @ctVendorId, @gpVendorId )
		END
		ELSE
		BEGIN
			UPDATE CT_GP_Vendor_Mapping SET GP_Vendor_Id = @gpVendorId WHERE CT_Vendor_Id = @ctVendorId
		END
	END	
END
